package org.zeapp.opencloud.framework.cloud;

/**
 * Represent a cloud entry. (a file or a directory)
 * 
 * @author Amphiprion
 * 
 */
public abstract class CloudEntry {
	private String name;
	private boolean file;
	private boolean folder;
	private String path;

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the file
	 */
	public boolean isFile() {
		return file;
	}

	/**
	 * @param file
	 *            the file to set
	 */
	protected void setFile(boolean file) {
		this.file = file;
	}

	/**
	 * @return the folder
	 */
	public boolean isFolder() {
		return folder;
	}

	/**
	 * @param folder
	 *            the folder to set
	 */
	protected void setFolder(boolean folder) {
		this.folder = folder;
	}

	/**
	 * @return the path
	 */
	public String getPath() {
		return path;
	}

	/**
	 * @param path
	 *            the path to set
	 */
	public void setPath(String path) {
		this.path = path;
	}

	/**
	 * Return this CloudEntry casted in CloudFile
	 * 
	 * @return the entry casted in CloudFile (watch out to the
	 *         ClassCastException)
	 */
	public CloudFile asFile() {
		return (CloudFile) this;
	}

	/**
	 * Return this CloudEntry casted in CloudFolder
	 * 
	 * @return the entry casted in CloudFolder (watch out to the
	 *         ClassCastException)
	 */
	public CloudFolder asFolder() {
		return (CloudFolder) this;
	}

}
